{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox-title">
        <h5>添加工厂</h5>
    </div>
    <div class="ibox-content layui-form">
        <div class="layui-row layui-col-space10 layui-form-item ">
            <input type="hidden" name="id" value="{$res.factory_id}">

            <!--<div class="layui-form-item layui-col-md-offset1 layui-col-md8">-->
                <!--<label class="layui-form-label">所属省份：</label>-->
                <!--<div class="layui-input-block">-->
                    <!--<select name="f_area" xm-select="select1" xm-select-radio="" lay-verify="required" xm-select-search="" xm-select-search-type="dl">-->
                        <!--{foreach name="data" item="v"}-->
                        <!--<option value="{$v.district_id}" {if $v['district_id']==$res['f_area']} selected {/if}>{$v.district}</option>-->
                        <!--{/foreach}-->
                    <!--</select>-->
                <!--</div>-->
            <!--</div>-->
            <!--<div class="layui-form-item layui-col-md-offset1 layui-col-md8">-->
                <!--<label class="layui-form-label">所属行业：</label>-->
                <!--<div class="layui-input-block">-->
                    <!--<select name="f_industry_id" xm-select="select2" xm-select-radio="" lay-verify="required" xm-select-search="" xm-select-search-type="dl">-->
                        <!--{foreach name="data1" item="v1"}-->
                        <!--<option value="{$v1.industry_id}" {if $v1['industry_id']==$res['f_industry_id']} selected {/if}>{$v1.industry_name}</option>-->
                        <!--{/foreach}-->
                    <!--</select>-->
                <!--</div>-->
            <!--</div>-->
            <!--<div class="layui-form-item layui-col-md-offset1 layui-col-md8">-->
                <!--<label class="layui-form-label">所属省级管理员：</label>-->
                <!--<div class="layui-input-block">-->
                    <!--<select name="f_id" xm-select="select3" xm-select-radio="" lay-verify="required" xm-select-search="" xm-select-search-type="dl">-->
                        <!--{foreach name="data2" item="v2"}-->
                        <!--<option value="{$v2.p_id}" {if $v2['p_id']==$res['f_id']} selected {/if}>{$v2.p_username}</option>-->
                        <!--{/foreach}-->
                    <!--</select>-->
                <!--</div>-->
            <!--</div>-->
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                <label class="layui-form-label">厂家名称：</label>
                <div class="layui-input-block">
                    <input type="text" value="{$res['factory_name']?$res['factory_name']:''}" maxlength="30" name="factory_name" lay-verify="required" placeholder="" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                <label class="layui-form-label">登录密码：</label>
                <div class="layui-input-block">
                    <input type="password" value="{$res['factory_pass']}" maxlength="16" name="factory_password" lay-verify="required" placeholder="" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存
                    </button>
                    <button class="layui-btn layui-btn-primary" onclick="history.go(-1)">返回</button>
                </div>
            </div>
        </div>
    </div>
</div>

{include file="public/footer" /}

<script>
    layui.use(['form'], function() {
        var form = layui.form;
        form.on('submit(component-form-element)', function (data) {
            $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
            $.ajax({
                url:"{:url('update')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        wk.success(res.msg,"{:url('factory/index')}")
                    } else {
                        wk.error(res.msg,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\')');
                    }
                }
            })
        });
    });
</script>
</body>
</html>